package it.asvp.asvp_portal.data.entity.domain;


import static javax.persistence.GenerationType.IDENTITY;
import it.asvp.asvp_portal.data.entity.member.Member;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

@SuppressWarnings("serial")
@Entity
@Table(name = "video", catalog = "asvp_db", uniqueConstraints = @UniqueConstraint(columnNames = "title"))
public class Video extends BaseEntity {
	
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	private Long id;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_member", nullable = false)
	private Member member;
	
	@Column(name = "title", unique = true, nullable = false, length = 50)
	private String title;
	
	@Column(name = "video_url", nullable = false)
	private String videoUrl;

	@Column(name = "description", nullable = false)
	private String description;

	public Video() {
	}

	public Video(Member member, String title, String videoUrl, Date createdOn,
			String description, Date lastUpdate) {
		this.member = member;
		this.title = title;
		this.videoUrl = videoUrl;
		this.createdOn = createdOn;
		this.description = description;
		this.lastUpdate = lastUpdate;
	}

	
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	
	public Member getMember() {
		return this.member;
	}

	public void setMember(Member member) {
		this.member = member;
	}


	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}


	public String getVideoUrl() {
		return this.videoUrl;
	}

	public void setVideoUrl(String videoUrl) {
		this.videoUrl = videoUrl;
	}
	
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

}
